package model;

import java.io.IOException;

public abstract class Item {
    protected int num;//物品数量
    protected String name;//物品名
    protected String type;//物品类型
    protected String desc;//物品描述
    protected String location;
    public Item() {}
    public Item(int num, String name, String type, String desc, String location) {
        this.num = num;
        this.name = name;
        this.type = type;
        this.desc = desc;
        this.location = location;
    }
    public int getNum() {
        return num;
    }
    public void setNum(int num) {
        this.num = num;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public void setLocation(String location) {
        this.location = location;
    }
    public String getLocation() {
        return location;
    }

    public abstract String getDesc();

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public boolean have() {
        return num>0;
    }

    public abstract boolean check(int x);

    public abstract int getMaxnum();

    public abstract void use(Player player)throws IOException;
}
